package com.example.surfaceviewcamera;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.hardware.Camera;
import android.hardware.Camera.Face;
import android.view.View;

public class ViewFace extends View{

	Paint paint = new Paint();
    List<Camera.Face> faces = new ArrayList<Camera.Face>();

	Matrix matrix = new Matrix();
    RectF rect = new RectF();
	
	public ViewFace(Context context) {
		super(context);
	}

	public void setFaces(List<Camera.Face> faces) {
		this.faces = faces;
	}

	@Override
	protected void onDraw(Canvas canvas) {
		canvas.drawRect(50f, 50f, 200f, 200f, paint);
        canvas.drawARGB(0, 0, 0, 0);
        
        for (Face face : faces) {
            rect.set(face.rect);
            canvas.drawRect(rect, paint);
        }
        super.onDraw(canvas);
	}
}
